package cn.com.wangluotongxin.admin.model.constants;

public enum DatabaseType {
    //    资源库 1.MYSQL 2.ORACLE 3.SQL_SERVER
    MYSQL(1, "MYSQL"),
    ORACLE(2, "ORACLE"),
    SQL_SERVER(3, "SQL_SERVER");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static DatabaseType getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            DatabaseType[] databaseTypes = values();
            for(DatabaseType databaseType : databaseTypes){
                if(databaseType.getCode().equals(code)){
                    return databaseType;
                }
            }
        }
        return null;
    }

    DatabaseType(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
